﻿using System.Windows;

namespace BeeCoders.Tools.Wpf.PdfCanvas.Converters
{
	public class RectangleConverter : PdfConverterBase, IPdfConverter
	{


		public void Convert(PdfCanvas canvas, iTextSharp.text.pdf.PdfContentByte cb, System.Windows.Shapes.Rectangle obj, Point origin, Point documentSize, Point aspectRatio)
		{
			Point p = PointToWindow(canvas, obj, new Point(0, 0));

			p = new Point(p.X * aspectRatio.X, p.Y * aspectRatio.Y);

			float oWidth = (float)obj.ActualWidth * (float)aspectRatio.X;
			float oHeight = (float)obj.ActualHeight * (float)aspectRatio.Y;

			BaseConverter.SetStroke(cb, obj.Stroke);
			cb.SetLineWidth((float)obj.StrokeThickness);

			cb.Rectangle((float)p.X, (float)documentSize.Y - (float)p.Y, oWidth, -oHeight);


			cb.SetCMYKColorFill(50, 20, 120, 15);
			//	cb.SetCMYKColorStroke(120, 100, 80, 150);
			cb.Stroke();
		}
	}
}
